package com.cfuture08.component.dwz;

import java.util.Iterator;
import java.util.List;

import com.cfuture08.util.xml.tag.XmlTag;
import com.cfuture08.util.xml.tag.XmlTagType;

public class UlTag {
	public UlTag() {
	}

	public UlTag(String clazz, List<LiTag> liList) {
		this.li = liList;
		this.clazz = clazz;
	}

	public List<LiTag> getLi() {
		return li;
	}

	public void setLi(List<LiTag> liList) {
		this.li = liList;
	}

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}

	public String getXmlBean() {
		return xmlBean;
	}

	public void setXmlBean(String xmlBean) {
		this.xmlBean = xmlBean;
	}

	@XmlTag(canRead = true, canWrite = true, type = XmlTagType.attriType, value = "")
	private String clazz;
	@XmlTag(canRead = true, canWrite = true, type = XmlTagType.listClassType, value = "com.cfuture08.component.dwz.LiTag")
	private List<LiTag> li;
	@XmlTag(canRead = true, canWrite = true, type = XmlTagType.attriType, value = "com.cfuture08.component.dwz.UlTag")
	private String xmlBean;

	public String toString() {
		StringBuilder sb = new StringBuilder();
		if (this.li != null && this.li.size() > 0) {
			if (this.clazz == null || "".equals(clazz)) {
				sb.append("<ul>");
			} else {
				sb.append("<ul class=\"");
				sb.append(this.clazz).append("\">");
			}

			for (Iterator<LiTag> it = this.li.iterator(); it.hasNext();) {
				sb.append(it.next().toString());
			}

			sb.append("</ul>");
		}
		return sb.toString();
	}
}
